package com.larry.mr.index;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @author larry
 * @Title: map-reduce
 * @Package com.larry.mr.index
 * @Description: TODO
 * @date 2022/5/1721:06
 */
public class TwoIndexReduce extends Reducer<Text,Text,Text,Text> {
    Text v = new Text();

    @Override
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        StringBuilder sb = new StringBuilder();
        for (Text value : values) {
            sb.append(value.toString().replaceAll("\t","-->")).append("\t");
        }

        v.set(sb.toString());

        context.write(key,v);
    }
}
